<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "head.ftl" />
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos">当前位置: 用户奖品 - 列表</div>
	<div class="clear"></div>
</div>
<div style="padding:10px;">
	<div>
	  <form id="search_from">
	  	<input type="text" name="searchWord" value="${searchWord}" placeholder="用户、奖品、兑换码"/>
        <input type="submit" value="查找"/>
      </form>
	</div>
	<div class="clear"></div>
</div>
<form id="tableForm" method="post">
<input type="hidden" name="pageNo" value="1"/>
<table class="pn-ltable" style="" width="100%" cellspacing="1" cellpadding="0" border="0">
<thead class="pn-lthead"><tr>
	<th width="20"><input type='checkbox' onclick='Pn.checkbox("ids",this.checked)'/></th>
	<th>ID</th>
	<th>用户</th>
	<th>奖品</th>
	<th>兑换码</th>
	<th>状态</th>
	<th>中奖时间</th>
	<th>兑换时间</th>
	</tr></thead>
<tbody  class="pn-ltbody">
<#list prizeWinList as p>
<tr>
	<td><input type='checkbox' name='ids' value='1'/></td>
	<td>${p.winId}</td>
	<td>${p.member.name}</td>
	<td>${p.name}</td>
	<td>${p.convertCode}</td>
	<td>${prizeWinStatuses[p.status].text}<#if p.status == 0><a href="javascript:;" id="convert_${p.winId}" style="color:blue;">(兑换)</a></#if></td>
	<td>${p.addTime?number_to_datetime}</td>
	<td><#if p.useTime gt 0>${p.useTime?number_to_datetime}</#if>&nbsp;</td>
</tr>
</#list>
</tbody>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" class="pn-sp">
	<div id="pageLink" class="pageLinks">${pageLink.linkString}</div>
</td></tr></table>
</form>
</div>
<script>
// 兑换请求路径
var convertPath = g_domain + "/prizeWin/convertDo/json";
// 事件:兑换
$("[id^='convert_']").click(function() {
	var winId = $(this).attr("id").replace("convert_", "");
	if (!confirm("确定要兑换[ID:" + winId + "]奖品吗?")) {
		return;
	}
	$.post(convertPath, {winId: winId}, function(data) {
		alert(data.message);
		if (data.status !== 0) {
			return;
		}
		pageReload.reload();
	});
});
</script>
</body>
</html>